/* Markdown渲染器样式 */
.markdown-renderer {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: #333;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.markdown-toolbar {
  position: sticky;
  top: 0;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  padding: 8px 16px;
  display: flex;
  justify-content: flex-end;
  z-index: 10;
}

.copy-button {
  background: #007bff;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
}

.copy-button:hover {
  background: #0056b3;
}

.markdown-content {
  padding: 20px;
  overflow-y: auto;
}

/* 标题样式 */
.markdown-h1 {
  font-size: 2em;
  font-weight: 700;
  margin: 0 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e9ecef;
  color: #2c3e50;
}

.markdown-h2 {
  font-size: 1.5em;
  font-weight: 600;
  margin: 24px 0 12px 0;
  color: #34495e;
}

.markdown-h3 {
  font-size: 1.25em;
  font-weight: 600;
  margin: 20px 0 8px 0;
  color: #34495e;
}

.markdown-h4 {
  font-size: 1.1em;
  font-weight: 600;
  margin: 16px 0 6px 0;
  color: #34495e;
}

.markdown-h5 {
  font-size: 1em;
  font-weight: 600;
  margin: 12px 0 4px 0;
  color: #34495e;
}

.markdown-h6 {
  font-size: 0.9em;
  font-weight: 600;
  margin: 8px 0 4px 0;
  color: #6c757d;
}

/* 段落样式 */
.markdown-p {
  margin: 0 0 16px 0;
  line-height: 1.7;
}

/* 代码样式 */
.markdown-code-block {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 16px;
  margin: 16px 0;
  overflow-x: auto;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
}

.markdown-code-block code {
  background: none;
  padding: 0;
  border: none;
  font-size: inherit;
}

.markdown-inline-code {
  background: #f1f3f4;
  color: #d63384;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9em;
}

/* 表格样式 */
.markdown-table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
}

.markdown-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
}

.markdown-table th,
.markdown-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #dee2e6;
}

.markdown-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #495057;
}

.markdown-table tr:hover {
  background: #f8f9fa;
}

/* 引用样式 */
.markdown-blockquote {
  margin: 16px 0;
  padding: 16px 20px;
  background: #f8f9fa;
  border-left: 4px solid #007bff;
  border-radius: 0 6px 6px 0;
  color: #6c757d;
  font-style: italic;
}

.markdown-blockquote p {
  margin: 0;
}

/* 列表样式 */
.markdown-ul,
.markdown-ol {
  margin: 16px 0;
  padding-left: 24px;
}

.markdown-li {
  margin: 4px 0;
  line-height: 1.6;
}

.markdown-ul .markdown-li {
  list-style-type: disc;
}

.markdown-ol .markdown-li {
  list-style-type: decimal;
}

/* 链接样式 */
.markdown-link {
  color: #007bff;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
}

.markdown-link:hover {
  color: #0056b3;
  border-bottom-color: #0056b3;
}

/* 图片样式 */
.markdown-image {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 16px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 分割线样式 */
.markdown-hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, transparent, #dee2e6, transparent);
  margin: 24px 0;
}

/* 强调样式 */
.markdown-strong {
  font-weight: 700;
  color: #2c3e50;
}

.markdown-em {
  font-style: italic;
  color: #495057;
}

.markdown-del {
  text-decoration: line-through;
  color: #6c757d;
}

/* 任务列表样式 */
.markdown-checkbox {
  margin-right: 8px;
  transform: scale(1.1);
}

/* 代码高亮样式覆盖 */
.markdown-code-block .hljs {
  background: #f8f9fa !important;
  padding: 0 !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .markdown-content {
    padding: 16px;
  }
  
  .markdown-h1 {
    font-size: 1.75em;
  }
  
  .markdown-h2 {
    font-size: 1.4em;
  }
  
  .markdown-h3 {
    font-size: 1.2em;
  }
  
  .markdown-table {
    font-size: 14px;
  }
  
  .markdown-table th,
  .markdown-table td {
    padding: 8px 12px;
  }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
  .markdown-renderer {
    background: #1a1a1a;
    color: #e0e0e0;
  }
  
  .markdown-toolbar {
    background: #2d2d2d;
    border-bottom-color: #404040;
  }
  
  .markdown-h1,
  .markdown-h2,
  .markdown-h3,
  .markdown-h4,
  .markdown-h5 {
    color: #f0f0f0;
  }
  
  .markdown-h6 {
    color: #b0b0b0;
  }
  
  .markdown-code-block {
    background: #2d2d2d;
    border-color: #404040;
  }
  
  .markdown-inline-code {
    background: #404040;
    color: #ff6b9d;
  }
  
  .markdown-table {
    border-color: #404040;
  }
  
  .markdown-table th {
    background: #2d2d2d;
    color: #e0e0e0;
  }
  
  .markdown-table tr:hover {
    background: #2d2d2d;
  }
  
  .markdown-blockquote {
    background: #2d2d2d;
    color: #b0b0b0;
  }
  
  .markdown-link {
    color: #4dabf7;
  }
  
  .markdown-link:hover {
    color: #339af0;
  }
}
